
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%@ include file="/WEB-INF/jsp/public/commons.jspf"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'form.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    

<script type="text/javascript">

function cle (){
	
	document.getElementById("hid").style.display = "none";

	};

</script>
<script>
	Function.prototype.Bind = function (object){
				var args = Array.prototype.slice.call(arguments, 1);
				var fun = this;
				return function() {
					return fun.apply(object, args.concat(Array.prototype.slice.apply(arguments)));
				}
			};
			Array.prototype.each = function(fun){
				var b = true;
				for (var i = 0, len = this.length; i < len; i++) { !!fun.call(this, this[i], i) ? b : (b = false); }
				return b;
			};
			window.$ = function (id){
				if(arguments.length > 1){
					var els = [];
					Array.prototype.each.call(arguments, function (a){els.push($(a));});
					return els;
				} else if("string" == typeof id){
					return document.getElementById(id);
				} else if(id.length && id.join){
					return $.apply(null, id);
				} else {
					return id;
				}
			};
			var Class = {
				create: function (def) {
					return function (){Extend(this, def||{}); def = null; this.initialize.apply(this, arguments); }
				}
			};
			var Extend = function(destination, source) {
				for (var property in source) { destination[property] = source[property]; }
				return destination;
			};
			var currentStyle = function(element){
				element = $(element);
				return element.currentStyle || document.defaultView.getComputedStyle(element, null);
			};
			var ScrollMsg = Class.create({
				options : {
					vertical : false,//是否垂直，需要在html代码中提供多行的表格
					auto : true,//是否自动
					duration : 1000,//滚动持续时间
					fps : 100,//帧数
					pauseTime : 3000,//停顿时间间隔
					onStart : function(){},//滚动开始前执行
					onFinish : function(){},//滚动结束后执行
					fx : function (t,b,c,d){
						return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
					}
				}
			});
			ScrollMsg.prototype = {
				initialize : function (container, num, options){
					this.setOptions(options);
					this.container = $(container);
					this.containerStyle = currentStyle(this.container);
					this.count = num;
					this.distance = (this.options.vertical ? this.container.scrollHeight : this.container.scrollWidth) / num;
					this.currIndex = 0;
					this.timer = null;
					this.pauseTimer = null;
					this.pos = this.options.vertical ? "top" : "left";
					if(this.options.auto){
						this.start();
					}
				},
				setOptions : function (options){
					Extend(this.options, options||{});
				},
				moveto : function (index){
					if(typeof index == "undefined" || index < 0){
						index = (this.currIndex < this.count-1 ? this.currIndex+1 : 0);
					} else{
						index = (index >= this.count ? this.count-1 : index);
					}
					this.clear();
					this.from = parseInt(this.containerStyle[this.pos]);
					this.change = -index * this.distance - this.from;
					this.currIndex = index;
					this.ctime = new Date().getTime();
					window.setTimeout(this.options.onStart.Bind(this), 10);
					this.timer = window.setInterval((function (){
						this.step();
					}).Bind(this), Math.round(1000/this.options.fps));
				},
				step : function (){
					var time = new Date().getTime();
					if(time <= this.ctime + this.options.duration){
						var t = time - this.ctime;
						this.container.style[this.pos] = this.compute(t);
					}else{
						this.clear();
						this.container.style[this.pos] = this.from + this.change;
						window.setTimeout(this.options.onFinish.Bind(this), 10);
						if(this.pauseTimer && this.options.auto)this.start();
					}
				},
				clear : function (){
					window.clearInterval(this.timer);
				},
				compute : function (t){
					return Math.round(this.options.fx(t, this.from, this.change, this.options.duration)) + "px";
				},
				stop : function (){
					window.clearTimeout(this.pauseTimer);
					this.pauseTimer = null;
				},
				start : function(){
					window.clearTimeout(this.pauseTimer);
					this.pauseTimer = window.setTimeout((function (){
						this.moveto();
					}).Bind(this), this.options.pauseTime);
				}
			};
function start(){
	scrollmsg.start();
}
function stop(){
	scrollmsg.stop();
}
function moveto(i){
	scrollmsg.moveto(i);
	stop();
}
function onStart(){
	var ci = this.currIndex;
	var a = $("indexarea").getElementsByTagName("a");
	for(var i=0; i < a.length; i++){
		if(i==ci) a[i].className="index onover";
		else a[i].className = "index";
	}
}
var elasticOut=function (){
     scrollmsg.options.fx = function(t, b, c, d, a, p){
		if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; if (!a) a = 1;
		if (a < Math.abs(c)){ a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin(c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
    }
   
 }
 
var bounceOut=function (){
      scrollmsg.options.fx = function(t, b, c, d){
		if ((t/=d) < (1/2.75)){
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)){
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)){
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
      }
}
var quadOut=function (){
      scrollmsg.options.fx= function(t, b, c, d){
		return -c *(t/=d)*(t-2) + b;
}
}
function change(v){
switch (v){
	case "elasticOut" : 
		elasticOut();break;
	case "bounceOut" : 
		bounceOut();break;
	case "quadOut" : 
		quadOut();break;
	}
}

//天气
	var weatherInfo = null;
	var weatherImg = "sunny";
	
	function wether(){
  			var v=new XMLHttpRequest();
  			v.open("post", "weather_info.do");
  			v.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  			v.send("");
  			v.onreadystatechange=function()
  			{
  			
  				if(v.readyState===4){
  					if(v.status===200){
  						//json要大写
  						var jsondata=JSON.parse(v.responseText);
						if(jsondata.weather=="晴"){
						weatherImg ="sunny";
						}else if (jsondata.weather=="阴") {
							weatherImg ="overcast";
						}else if (jsondata.weather=="多云") {
							weatherImg ="cloudy";
						}else if (jsondata.weather=="大雨") {
							weatherImg ="heavy_rain";
						}else if (jsondata.weather=="小雨") {
							weatherImg ="light_rain";
						}else if (jsondata.weather=="中雨") {
							weatherImg ="moderate_rain";
						}
						else if (jsondata.weather=="阵雨") {
							weatherImg ="rain_Shower";
						}


  						document.getElementById("img_weather").src="${pageContext.request.contextPath}/style/images/weather/"+weatherImg+".gif";
  					
						document.getElementById("masage").innerHTML=jsondata.city+ ":"+ jsondata.weather+"<br/>最低气温："+jsondata.l_tmp +" ℃<br/>最高气温："+jsondata.h_tmp +" ℃<br/>" +jsondata.WS +","+jsondata.WD;
  					}
  				}
  			}
		
		}
	


</script>

	<style type="text/css">
*{font-size:9pt;}
	body{
	padding:0px 0px 0px 0px;
	margin:0px 0px 0px 0px;
	background-color:#d8edfc;
	color: #004779;
	}
	
	.outer{
		background-color:#d8edfc;
		position: absolute;
		top:0px;
		left: 0px;
		border:0px solid #468C8C;
		overflow:hidden;
		cursor: default;
	}
	.scroll-message{
	    margin-left:5px;
	    margin-right:5px;
		background-color:#d8edfc;
		position: relative;
		width : 218px;
		height : 260px;
		border:0px solid #839D92;
		overflow:hidden;
	}
	.item {
		background-color:#d8edfc;
		overflow:hidden;
		border-bottom:1px solid #468C8C;
		width : 218px;
		height : 218px;
		
	}
	.index{
		text-align:center;
		display:block;
		height:15px;
		width:15px;
		borer:1px solid black;
		background-color: #226666;
		color:#FFF !important;
		text-decoration: none !important;
		line-height: 15px;
	}
	.index:hover{
		font-weight: bold; background-color: red;
	}
	.onover{font-weight: bold; background-color: red;}
	.msgtitle{height:25px; font-size:15px; color: red; text-align:center;margin-bottom: 10px;}
        .msgtitle a:hover{background-color:transparent;}
	.t{ text-align:right; color:#686F6F; font-style: italic; line-height: 20px;}
	.msgcontent{clear: both;font-size:14px;}
	#scrollmessage{position: relative; top:0px;left:0px;}
	
	/*天气*/
	.weather{
    height:63px;
    width:220px;
	background-color:#d8edfc;
	}
	.weather img{
	margin-left: 65px;
	}
	
	#masage{
	padding:5px 0px 0px 5px;
	font-size:16px;
	background-color: #d8edfc;
	clear:both;
	 height:200px;
    width:220px;
	}
	</style>
	
  </head>
  
  <body onload ="wether()">
  <!-- 天气开始 -->
 <div class="wt">
 	<div class="weather">
 	<img id="img_weather" style="cursor:pointer;" alt="天气预报" src="${pageContext.request.contextPath}/style/images/weather/sunny.gif"></img>
 	</div >
 	<div id="masage">
 		
 	</div>
 </div>
 
 <!-- 通知开始 -->
<div style="position: absolute; top:240px;">
	<div class="outer" id="hid" style="top: 5px; left: 1px;">
		<div class="scroll-message">

			<table border="0" cellpadding="0" cellspacing="0" id="scrollmessage">
				<tbody>
					<tr>
					
						<s:iterator value="noticeList">
						<td>
							<div class="item">
								<div class="msgtitle">
									<b onclick="return false" onmouseout="start()" onmouseover="stop()"><s:property value="title" /></b></div>
								<div class="msgcontent">
									&nbsp;&nbsp;&nbsp;&nbsp;<s:property value="content" />
								</div>
								<div class="t">
									<span><s:property value="date" /></span></div>
							</div>
						</td>
						</s:iterator>
					</tr>
				</tbody>
			</table>
		</div>
		<table cellpadding="0" cellspacing="5" style="position: absolute; bottom: 0px; left: 5px;">
			<tbody>
				<tr id="indexarea">
				<s:iterator value="noticeList" status="st">
					<td>
						<a class="index" href="#" onclick="return false" onmouseout="start()" onmouseover="moveto(<s:property value='#st.index'/>)"><s:property value='#st.index'/></a></td>
						<input type="hidden" value="#st.Count" name="count" >
					<td>
				</s:iterator>
			<label onclick="cle();"  style="cursor: pointer;">关闭公告</label>
				</tr>
			</tbody>
		</table>
	</div>
</div>
<script>window.scrollmsg = new ScrollMsg("scrollmessage",document.getElementsByName("count").length, {onStart:onStart});</script>
</body>

